<h1>Eventos</h1>
<?php if($sf_user->hasFlash('msg')){ ?>
<div class="message">
  <?php echo $sf_user->getFlash('msg') ?>
</div>
<br />
<?php } ?>
<a href="<?php echo url_for('@noticias_evento_new') ?>">Nuevo evento</a>
  <br /><br />
<table width="100%" cellpadding="5" cellspacing="0" border="1" class="list">
  <thead>
  <tr>
    <td>Titulo</td>
    <td>Fecha de actualizaci&oacute;n de estado</td>
    <td>Editar</td>
    <td>Eliminar</td>
  </tr>
  </thead>
  <tbody>
<?php if($pager->getNbResults()!=0){ ?>
  <?php foreach($pager->getResults() as $row){ ?>
  <tr>
    <td><?php echo html_entity_decode($row->getTitle()) ?></td>
    <td>
        <!-- devuelve el string definido como "substr(dato,inicio,finalx)"-->
    <?php
        $date = $row->getDate();
        $year = substr($date,0,4);
        $month = substr($date,5,2);
        $day = substr($date,8,2);
        echo $f_date = $day."/".$month."/".$year;
    ?>
    </td>
    <td>
        <a href="<?php echo url_for('@noticias_evento_edit?id='.$row->getId()) ?>">Editar</a>
    </td>
    <td>
        <a href="<?php echo url_for('@noticias_evento_delete?id='.$row->getId()) ?>" onclick="return delete_confirm()">Eliminar</a>
    </td>
  </tr>
  <?php } ?>
<?php }else{ ?>
  <tr>
      <td colspan="3">No existes registros</td>
  </tr>
<?php } ?>
  </tbody>
</table>
  <br />
<?php if ($pager->haveToPaginate()): ?>
  <div class="pagination">
    <?php if($pager->getPreviousPage()!=$pager->getPage()){ ?>
        <a href="?page=<?php echo $pager->getPreviousPage() ?>">Anterior</a>
    <?php } ?>
    <?php foreach ($pager->getLinks() as $page): ?>
        <?php if ($page == $pager->getPage()): ?>
            <?php echo $page ?>
        <?php else: ?>
            <a href="?page=<?php echo $page ?>">
                <?php echo $page ?></a>
        <?php endif; ?>
    <?php endforeach; ?>
    <?php if($pager->getNextPage()!=$pager->getPage()){ ?>
        <a href="?page=<?php echo $pager->getNextPage() ?>">Siguiente</a>
    <?php } ?>
  </div>
<?php endif; ?>